﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RefLib.MVC.Util
{
    public class ScriptBuilder
    {
        public void AddLine(string line)
        {
            _lines.Add(line);
        }

        public string GetScriptBlock(string type = "text/javascript")
        {
            var sb = new StringBuilder();
            sb.AppendLine(String.Format("<script type=\"{0}\">", type));
            foreach (string line in _lines)
            {
                sb.AppendLine("\t" + line);
            }
            sb.AppendLine("</script>");
            return sb.ToString();
        }

        private List<string> _lines = new List<string>();
    }
}
